<extend name="Base/common"/>
<block name="body">
	<div class="container">
		<div class="nav">
		    <img src="__IMG__/img_1.png" alt="" id="show">			
			<h3>订单列表</h3>
		</div>
		<!--<ul class="order">
			<li><span>交易日期</span><span>商品名称</span><span>方向</span><span>当前价格</span><span>盈利</span><span>操作</span></li>
			 <volist name="list" id="vo">
			 		<li>
			 		<span>{$vo.create_time}</span>
			 		<span>{$vo.name}</span>
			 		<span>{$vo.number_direction}</span>
			 		<span>{$vo.last_price}</span>
			 		<span>{$vo.profit}</span>
			 		<if condition="$vo['status'] eq 1">
			 		<span>平仓</span>
			 		<else />
			 		<span></span>
			 		</if>
			 		</li>
			 </volist>
		</ul>-->
		
		
		<ul class="order">
			<li>
				<span class="order-span1">交割日期</span>
				<span class="order-span2">商品名称</span>
				<span class="order-span3">方向</span>
				<span class="order-span4">盈利</span>
				<span class="order-span5">操作</span>
			</li>
			 <volist name="list" id="vo">
			<li><span class="order-span1">{$vo.create_time}</span>
				<span class="order-span2">{$vo.name}</span>
				<span class="order-span3">{$vo.number_direction}</span>
				<span class="order-span4">{$vo.profit}</span>
				<span class="order-span5">
					<a class="order-a" data-click=0 href="javscript:void(0)">详情</a>
				</span>
				<div class="order-maos">
					<table class="order-table">
						<tr>
							<td>状态</td>
							<td>买入价格</td>
							<td>最新价格</td>
							<td></td>
						</tr>
						<tr>
							<td><if condition="$vo['status'] eq 1">进行中<else/>等待中</if></td>
							<td>{$vo.open_price}</td>
							<td>{$vo.last_price}</td>
							<!-- <td>
								<if condition="$vo['status'] eq 1">
									<if condition="$vo['authority_status'] eq 1">
								<a class="order-a" href="javascript:sub_form({$vo.id},{$vo.last_price})">平仓</a>
									</if>
								</if>	
							</td> -->
						</tr>
						
					</table>
				</div>
			</li>
			 </volist>
		</ul>
		
		<!--弹出开始-->
		<div class="dailog_mask"></div>
		<div class="order-mode" data-id=''>
			<div class="order-modediv">
				平仓价
				<img class="order-modeimg" src="__IMG__/img_22.png" />
			</div>
			<input type="hidden" id="id" name="id" value="">
			<input class="order-modeinput" name="price" id="price" value="" type="text" pattern="[0-9]*" disabled/>
			<p class="order-p">ddd</p>
			<a class="order-modea" id="sub_form_two" href="javascript:sub_form_two()" >确认</a>
		</div>
		<!--弹出结束-->
		
		
		
		<!--翻页  开始-->
		<div class="flip-pag">
		{$page}
		<!--翻页 结束-->
		
		
	</div>

<script type="text/javascript">
//平仓提交
function sub_form(id,price){
	$('#id').val(id);
	$('#price').val(price);
}
function sub_form_two(){
	$('#sub_form_two').attr('href','javascript:void(0)');
	$('#sub_form_two').css('background-color','#bab8b6');
	var id=$('#id').val();
	var price=$('#price').val();
	var url_href="{:U('Order/order_unwind')}";
	$.post(
		url_href,
		{
			id:id,
			price:price,
		},
		function(data){
			if(data.status){
				//alert(data.msg);
				$('.order-p').show();
				$('.order-p').html(data.msg);
				setTimeout(link_url,1000);
			}else{
				$('.order-p').show();
			 	$('.order-p').html(data.msg);
			 	setTimeout(link_url,1000);
			}
		}
		,'JSON')
}
function link_url(){
	window.location.reload();		
}
//平仓弹窗
$('.order-table').find('.order-a').each(function(){
	$(this).click(function(){
		$('.dailog_mask').toggle();
		$('.order-mode').toggle().attr('data-id',$(this).attr('data-id'));
	});
})
$('.dailog_mask').click(function(){
	$('.order-mode').toggle();
	$(this).toggle();
})
$('.order-modeimg').click(function(){
	$('.order-mode').toggle();
	$('.dailog_mask').toggle();
})


//点击展开详情
$('.order-span5').find('.order-a').each(function(){
	$(this).click(function(){
		var clik=$(this).attr('data-click');
		if(clik==0){

			$(this).parent().parent().find('.order-maos').css('display','block')
			$(this).css('background','#4c535e');
			$(this).html('关闭');
			$(this).attr('data-click','1');
		}else{
			$(this).parent().parent().find('.order-maos').css('display','none')
			$(this).css('background','#de362a');
			$(this).html('详情');
			$(this).attr('data-click','0');
		}
			
	})
})








//翻页  开始
        //翻页  开始
$('.flip-import').click(function(){
    $(this).css('display','none');
    $('.flip-input').css('display','inline-block');
    $('.flip-input').focus();
})
$('.flip-go').click(function(){
    var page = $('.flip-input').val();
    window.location.href="{$url}"+"/p/"+page;
    $('.flip-input').css('display','none');
    $('.flip-import').css('display','inline-block');
   
})
//翻页  结束

</script>
</block>